<?php
class AnniversaryStepVo extends SzAbstractMySqlVo
{

    private $userId;
    private $aId;
    private $buyStep;
    private $remarks;
    private $createTime;
    private $updateTime;
    private $endTime;

    /**
     * Initialize AnniversaryStepVo.
     *
     * @param $userId
     * @param $aId
     * @param $buyStep
     * @param $remarks
     * @param $createTime
     * @param $updateTime
     * @param $endTime
     * @param boolean $isInsert default false, means for now this vo is initialized not for insert process
     * @return AnniversaryStepVo
     */
    public function __construct($userId, $aId, $buyStep, $remarks, $createTime, $updateTime, $endTime, $isInsert = false) {
        $this->userId = $userId;
        $this->aId = $aId;
        $this->buyStep = $buyStep;
        $this->remarks = json_decode($remarks, true);
        $this->createTime = $createTime;
        $this->updateTime = $updateTime;
        $this->endTime = $endTime;

        $this->isInsert = $isInsert;
        $this->voClassName = 'AnniversaryStepVo';
        $this->ormName = 'AnniversaryStep';
    }

    /**
     * @see SzAbstractVo::toArray
     */
    public function toArray($needEncode = false)
    {
        return array(
            'userId' => $this->getUserId(),
            'aId' => $this->getAId(),
            'buyStep' => $this->getBuyStep(),
            'remarks' => ($needEncode) ? $this->getRemarks() : $this->getRawRemarks(),
            'createTime' => $this->getCreateTime(),
            'updateTime' => $this->getUpdateTime(),
            'endTime' => $this->getEndTime(),
        );
    }

    /**
     * @see SzAbstractVo::toEntireArray
     */
    public function toEntireArray($needEncode = false)
    {
        return array(
            'userId' => $this->getUserId(),
            'aId' => $this->getAId(),
            'buyStep' => $this->getBuyStep(),
            'remarks' => ($needEncode) ? $this->getRemarks() : $this->getRawRemarks(),
            'createTime' => $this->getCreateTime(),
            'updateTime' => $this->getUpdateTime(),
            'endTime' => $this->getEndTime(),
        );
    }

    /**
     * @see SzAbstractVo::toPureArray
     */
    public function toPureArray()
    {
        return array(
            $this->getUserId(),
            $this->getAId(),
            $this->getBuyStep(),
            $this->getRemarks(),
            $this->getCreateTime(),
            $this->getUpdateTime(),
            $this->getEndTime(),
        );
    }

    public function getUserId()
    {
        return $this->userId;
    }

    public function setUserId($val)
    {
        $this->saveColumnStatus(0, $this->userId);
        $this->userId = $val;
    }

    public function getAId()
    {
        return $this->aId;
    }

    public function setAId($val)
    {
        $this->saveColumnStatus(1, $this->aId);
        $this->aId = $val;
    }

    public function getBuyStep()
    {
        return $this->buyStep;
    }

    public function setBuyStep($val)
    {
        $this->saveColumnStatus(2, $this->buyStep);
        $this->buyStep = $val;
    }

    public function getRemarks()
    {
        return json_encode($this->remarks);
    }

    public function getRawRemarks()
    {
        return $this->remarks;
    }

    public function setRemarks($val)
    {
        $encodedLength = SzUtility::strLen(json_encode($val));
        if ($encodedLength > 25600) {
            SzLogger::get()->error('[AnniversaryStepVo] The length of column remarks exceed the limit, length / limit: ' . $encodedLength . ' / 25600');
            throw new SzException(10522, array('AnniversaryStepVo', '25600', $encodedLength));
        } else if ($encodedLength > 23040) {
            SzLogger::get()->warn('[AnniversaryStepVo] The length of column remarks exceed the warning level, length / limit: ' . $encodedLength . ' / 25600');
        }
        $this->saveColumnStatus(3, $this->remarks);
        $this->remarks = $val;
    }

    public function getCreateTime()
    {
        return $this->createTime;
    }

    public function setCreateTime($val)
    {
        $this->saveColumnStatus(4, $this->createTime);
        $this->createTime = $val;
    }

    public function getUpdateTime()
    {
        return $this->updateTime;
    }

    public function setUpdateTime($val)
    {
        $this->saveColumnStatus(5, $this->updateTime);
        $this->updateTime = $val;
    }

    public function getEndTime()
    {
        return $this->endTime;
    }

    public function setEndTime($val)
    {
        $this->saveColumnStatus(6, $this->endTime);
        $this->endTime = $val;
    }

}